#pragma once
#include <windows.h>
#include <vector>
using std::vector;
#include "CBitmap.h"
#include "CBufferDC.h"

#define SAFE_DELETE(p) { if (p) { delete p; p = NULL; } }

class CObject
{
public:
	CObject();
	virtual ~CObject();

public:
	virtual bool Init(CBitmap * pBitmap) = 0;
	virtual void Render(CBufferDC * pBufferDC) = 0;
	virtual void Updata(UINT nFpsTime) = 0;
	virtual LRESULT MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) = 0;

public:
	UINT GetID() const;
	void SetPos(int x, int y);
	POINT GetPos();
	void SetSize(int w, int h);
	SIZE GetSize();
	RECT GetRect();
	void SetMidpoint(POINT pt);
	POINT GetMidpoint();

protected:
	static UINT	m_sID;
	long		m_ID;
	POINT		m_Pos;
	SIZE		m_SrcSize;
	SIZE		m_Size;

	vector<HDC> m_hDCs;
};